//接口请求示例为：`http://open.api.tianyancha.com/services/v3/open/investtree?flag=${encodeURIComponent('2')}&dir=${encodeURIComponent('down')}&keyword=${encodeURIComponent('北京百度网讯科技有限公司')}

const axios = require("axios");

async function getInvestTree(keyword) {
    const url = "http://open.api.tianyancha.com/services/v3/open/investtree";

    const headers = {
        Authorization: "5826afef-8b42-4d09-80e4-063551764cae",
        // Authorization: "sadsad",
    };

    let params = {
        flag: 4,
        dir: "down",
        keyword: keyword,
    };
    const res = await axios.get(url, { params, headers });
    return res.data;
}

module.exports = {
    getInvestTree,
};
